const ratio = window.devicePixelRatio;
export default {
    loadImage(src: string): Promise<HTMLImageElement> {
        return new Promise((res) => {
            const image = new Image();
            image.crossOrigin = 'anonymous';
            image.onload = () => {
                res(image);
            }
            image.src = src;
        });
    },
    getScaleRatioSize(p: number) {
        return ratio * p;
    },
    getScaleMinRatioSize(p: number) {
        return p / ratio;
    },
    isIos() {
        const u = navigator.userAgent;
        return !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
    },
}
